package STUDENT.TRANDAODAIVI.BASIC.BaiTapCauTruc;
import java.util.InputMismatchException;
import java.util.Scanner;
public class BT5 {
public static void main(String[] args) {
	Scanner input=new Scanner(System.in);
	try {
	System.out.println("Dang ki tham gia ket ban");
	System.out.print("Ten: ");
	String ten=input.nextLine();
	System.out.print("Tuoi: ");
	String temp=input.nextLine();

	System.out.print("Gioi tinh: " );
	input=new Scanner(System.in);
	String gender=input.nextLine();
	System.out.print("Tinh trang hon nhan: ");
	String status=input.nextLine();
	
	if(temp.isEmpty()||status.isEmpty()||gender.isEmpty()){
		System.out.println("Ban phai nhap 3 thong tin chinh");
	}else{
	int tuoi=Integer.parseInt(temp);
	
	if (gender.equalsIgnoreCase("Nam")&&tuoi>=22&&status!="Co gia dinh"){
		System.out.println("Duoc tham gia");
	}
	else if(gender.equalsIgnoreCase("Nu")&&tuoi>=19&&status!="Co gia dinh"){
		System.out.println("Duoc tham gia");
	}
	else {System.out.println("Khong duoc tham gia");}}}
	catch(InputMismatchException exc){
		System.out.println("Nhap sai du lieu, vui long kiem tra lai");
	}
	
}
}
